{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "45f6d9eb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.2.5\n",
      "1.21.0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "print(pd.__version__)\n",
    "print(np.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c2cf7ffd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "d    4\n",
       "Name: x, dtype: int64"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = pd.Series([1, 2, 3, 4], index=[\"a\", \"b\", \"c\", \"d\"], name=\"x\")\n",
    "\n",
    "#查看数据行\n",
    "s.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f5b439da",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "Name: x, dtype: int64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.head(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9aab6aaa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "d    4\n",
       "Name: x, dtype: int64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "abd9acc2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "c    3\n",
       "d    4\n",
       "Name: x, dtype: int64"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.tail(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4627fc5a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    4.000000\n",
       "mean     2.500000\n",
       "std      1.290994\n",
       "min      1.000000\n",
       "25%      1.750000\n",
       "50%      2.500000\n",
       "75%      3.250000\n",
       "max      4.000000\n",
       "Name: x, dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#描述性统计\n",
    "s.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "4de7f2d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    NaN\n",
       "b    1.0\n",
       "c    1.0\n",
       "d    1.0\n",
       "Name: x, dtype: float64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#一阶查分\n",
    "s.diff()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
